/*
 * All rights Reserved, Designed By www.goldbeacon.cn
 * @Title:  demo
 * @Package cn.goldbeacon.demo.common.config
 * @author: zoujie
 * @date:   2021/7/2313:55
 * @version V1.0
 * Copyright © 2021 www.goldbeacon.cn. All Rights Reserved.
 * 注意：本内容仅限于湖南金烽信息科技有限公司内部传阅，禁止外泄以及用于其他的商业目
 */
package com.chenzhengrong.demospringboot.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.spring.web.SpringfoxWebMvcConfiguration;

/**
 * @author zoujie
 * @title: WebMvcConfig
 * @description: webmvc配置文件
 * @date 2021/7/2313:55
 */
@Configuration
@ConditionalOnClass(SpringfoxWebMvcConfiguration.class)
public class WebMvcConfig  implements WebMvcConfigurer {

    /**
    * @description: 重写addResourceHandlers，注册swagger需要的资源
    * @param registry 资源注册
    * @return void
    * @author zoujie
    * @date 2021/7/23 13:56
    */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("swagger-ui.html");
        registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
}
